﻿package GameStates 
{
	import flash.display.MovieClip;
	import flash.events.Event;

	/**
	 * ...
	 * @author Ivan Lucas Neves
	 */
	public class LevelManager extends MovieClip
	{
		var countLevel :int;
		var level_01 :Level_01;
		var level_02 :Level_02;
		var score : int = 0;
		
		public function LevelManager() 
		{
			countLevel = 1;
			
			addEventListener(Event.ENTER_FRAME, update, false, 0, true)
			
			
			if(countLevel == 1)
			{
				level_01 = new Level_01();
				addChild(level_01);		
			}
			else if (countLevel == 2)
			{				
				level_02 = new Level_02();
				addChild(level_02);				
			}

		}
		
		
		function update(e:Event):void
		{
			
			if(countLevel == 1)
			{
				
				level_01.Update();
			}
			else if (countLevel == 2)
			{
				if ( level_01 != null)
				{
					removeChild(level_01)
				}
			
				level_02.Update();
				
			}
			
		}
	}

}